// 导入 vue-router
import {createRouter, createWebHistory} from "vue-router";

// 导入组件
import LoginVue from "@/views/Login.vue";
import LayoutVue from "@/views/Layout.vue";

// 定义路由关系
const routers = [
    {
        path: "/login",
        component: LoginVue
    },
    {
        path: "/",
        component: LayoutVue,
        redirect: "/article/manage",
        // 子路由
        children: [
            {path: '/article/category', component: () => import( "@/views/article/ArticleCategory.vue")},
            {path: '/article/manage', component: () => import( "@/views/article/ArticleManage.vue")},
            {path: '/user/info', component: () => import( "@/views/user/UserInfo.vue")},
            {path: '/user/avatar', component: () => import( "@/views/user/UserAvatar.vue")},
            {path: '/user/resetPassword', component: () => import( "@/views/user/UserResetPassword.vue")},
        ]
    }
]

// 创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routers
});

export default router;
